Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SECURITY] Bug fix for topN on draggables #70450

Merged
merged 14 commits into from
Jul 3, 2020
Merged

Conversation

XavierM
Copy link
Contributor

@XavierM XavierM commented Jul 1, 2020

Summary

We lost some features on the topN due to the introduction of the global timeline context + we were doing some branching logic on i18n field.

Now the branch logic is done on the timelineID and we will only get the timelineId when users hover the TopN icon just before they click on it. And applied the same logic for the filter management.

Checklist

Delete any items that are not applicable to this PR.

@XavierM XavierM added bug Fixes for quality problems that affect the customer experience Team:SIEM v8.0.0 release_note:skip Skip the PR/issue when compiling release notes v7.9.0 labels Jul 1, 2020
@XavierM XavierM requested review from a team as code owners July 1, 2020 14:11
@XavierM XavierM self-assigned this Jul 1, 2020
@elasticmachine
Copy link
Contributor

Pinging @elastic/siem (Team:SIEM)

@@ -95,6 +95,10 @@ const TopNComponent: React.FC<Props> = ({
const [view, setView] = useState<EventType>(defaultView);
const onViewSelected = useCallback((value: string) => setView(value as EventType), [setView]);

useEffect(() => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for adding this to handle the scenario where a user changes the Timeline events filter while the graph is already open! 🙏

@XavierM
Copy link
Contributor Author

XavierM commented Jul 1, 2020

@elasticmachine merge upstream

Copy link
Contributor

@stephmilovic stephmilovic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

code review looks good, just had the one question on that test. pulled and manually tested a variety of timelines and all the filter managers are working as expected. hopefully this is the last bug! LGTM 👍

return (
useEffect(() => {
setShowHoverContent(false);
}, [closePopOverTrigger]);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

consider declaring setShowHoverContent as a dependency

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there is no need because it is from useState

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -75,11 +75,12 @@ const escapeWhitespace = (val: string) =>
const escapeSpecialCharacters = (val: string) => val.replace(/["]/g, '\\$&'); // $& means the whole matched string

// See the Keyword rule in kuery.peg
const escapeAndOr = (val: string) => val.replace(/(\s+)(and|or)(\s+)/gi, '$1\\$2$3');
// I do not think that we need that anymore since we are doing a full match_phrase all the time now => return `"${escapeKuery(val)}"`;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did some desk testing around this and agree 🙏
consider removing this meta-comment, and the commented-out definitions below 🙏

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Build metrics

@kbn/optimizer bundle module count

id value diff baseline
securitySolution 791 +1 790

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

Copy link
Contributor

@andrew-goldstein andrew-goldstein left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fixes, refactoring, and ❤️ in this PR @XavierM! 🙏🙏🙏
I desk tested the Top N and Filter for / out context menu actions in Overview, Alerts, Events, Timeline, plus sub-contexts, including the Field and Value of expanded events, and in the Customize Columns view.
LGTM 🚀

@XavierM XavierM merged commit 78fc9fb into elastic:master Jul 3, 2020
XavierM added a commit to XavierM/kibana that referenced this pull request Jul 3, 2020
* back to normal

* add unit test

* hover issue + indexToAdd issue

* fix unit test

* review II

* fix bug + review

* simplification

* do not update state when component is unmounted

* fix hover action on field name

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
XavierM added a commit that referenced this pull request Jul 3, 2020
* back to normal

* add unit test

* hover issue + indexToAdd issue

* fix unit test

* review II

* fix bug + review

* simplification

* do not update state when component is unmounted

* fix hover action on field name

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
gmmorris added a commit to gmmorris/kibana that referenced this pull request Jul 6, 2020
* master:
  [APM-UI] e2e speed up build (elastic#70704)
  skip flaky suite (elastic#70764)
  skip flaky suite (elastic#70762)
  [Security Solution][Endpoint] Update to new manifest format (without compression) (elastic#70752)
  [functional tests] test url field formatter on dashboard and discover (elastic#70736)
  logout from transform_poweruser user in after method of transform tests (elastic#70644)
  [SECURITY] Bug fix for topN on draggables (elastic#70450)
  [Logs UI] Reorganise log rate anomaly table (elastic#69516)
  Update dependency @elastic/charts to v19.7.0 (elastic#69791)
  Add googlecloud metricbeat module to Kibana Home (elastic#70652)
  [Logs UI] Logs overview queries for the observability dashboard (elastic#70413)
  [Lens] Fitting functions (elastic#69820)
gmmorris added a commit to gmmorris/kibana that referenced this pull request Jul 6, 2020
* master:
  [APM-UI] e2e speed up build (elastic#70704)
  skip flaky suite (elastic#70764)
  skip flaky suite (elastic#70762)
  [Security Solution][Endpoint] Update to new manifest format (without compression) (elastic#70752)
  [functional tests] test url field formatter on dashboard and discover (elastic#70736)
  logout from transform_poweruser user in after method of transform tests (elastic#70644)
  [SECURITY] Bug fix for topN on draggables (elastic#70450)
  [Logs UI] Reorganise log rate anomaly table (elastic#69516)
  Update dependency @elastic/charts to v19.7.0 (elastic#69791)
  Add googlecloud metricbeat module to Kibana Home (elastic#70652)
  [Logs UI] Logs overview queries for the observability dashboard (elastic#70413)
gmmorris added a commit to gmmorris/kibana that referenced this pull request Jul 6, 2020
* actions/feature:
  fixed type errors
  [APM-UI] e2e speed up build (elastic#70704)
  skip flaky suite (elastic#70764)
  skip flaky suite (elastic#70762)
  [Security Solution][Endpoint] Update to new manifest format (without compression) (elastic#70752)
  [functional tests] test url field formatter on dashboard and discover (elastic#70736)
  logout from transform_poweruser user in after method of transform tests (elastic#70644)
  [SECURITY] Bug fix for topN on draggables (elastic#70450)
  [Logs UI] Reorganise log rate anomaly table (elastic#69516)
  Update dependency @elastic/charts to v19.7.0 (elastic#69791)
  Add googlecloud metricbeat module to Kibana Home (elastic#70652)
  [Logs UI] Logs overview queries for the observability dashboard (elastic#70413)
@MindyRS MindyRS added the Team: SecuritySolution Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc. label Sep 23, 2021
@elasticmachine
Copy link
Contributor

Pinging @elastic/security-solution (Team: SecuritySolution)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Fixes for quality problems that affect the customer experience release_note:skip Skip the PR/issue when compiling release notes Team: SecuritySolution Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc. Team:SIEM v7.9.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants